Skip to content

Formatter: Fix formatting <% else %> in inline mode#809

Merged
marcoroth merged 2 commits into
mainfrom
foramtter-conditional-inline-mode
Nov 8, 2025
Merged

Formatter: Fix formatting <% else %> in inline mode#809
marcoroth merged 2 commits into
mainfrom
foramtter-conditional-inline-mode

Conversation

@marcoroth

@marcoroth marcoroth commented Nov 8, 2025

Copy link
Copy Markdown
Owner

This pull request fixes a bug in the formatter, where we accidentally visited the end_node twice, instead of the subsequent node.

This following document

<span>
  <% if valid? %>
    Valid
  <% else %>
    Invalid
  <% end %>
</span>

was previously formatter to:

<span><% if valid? %>Valid<% end %><% end %></span>

Now it gets correctly formatted as:

<span><% if valid? %>Valid<% else %>Invalid<% end %></span>

Resolves #789

@marcoroth marcoroth added the bug Something isn't working label Nov 8, 2025
@marcoroth marcoroth merged commit 8d9ed54 into main Nov 8, 2025
12 checks passed
@marcoroth marcoroth deleted the foramtter-conditional-inline-mode branch November 8, 2025 18:15
@tk0miya

tk0miya commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

Thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working formatter typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formatter: herb-format breaks HTML having <span> and if-else block

2 participants